import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/*
const routes = [
  {

    path: '/examine',
    component: Layout,
    children: [
      {
        path: '',
        component: () => import('@/views/Examine'),
        name: 'Examine',
        meta: {title: '审核', icon: 'data', noCache: true}
      }
    ]
  ,
*/


  /*}
    ]*/

export const constantRoutes = [
  {
    path: '/blogStore',
    component: () => import('@/views/BlogStore'),
    hidden: true
  },
  {
  path: '/editor',
  component: () => import('@/views/Editor'),
  hidden: true
},
  {
    path: '/updateBlog',
    component: () => import('@/views/UpdateBlog'),
    hidden: true
  },

  {
    path: '/detail',
    component: () => import('@/views/Detail'),
    hidden: true
  },
  {
    path: '/message',
    component: () => import('@/views/Message'),
    hidden: true
  },
  {
    path: '/myblog',
    component: () => import('@/views/Myblog'),
    hidden: true
  },
  {
    path: '/show',
    component: () => import('@/views/Show'),
    hidden: true
  },
  {
    path: '/test',
    component: () => import('@/views/Test'),
    hidden: true
  },

  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/store',
    component: () => import('@/views/Store'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '首页', icon: 'dashboard' }
    },

      {
        path: '/bigData',
        component: () => import('@/views/BigData'),
        hidden: true
      },
      {
        path: '/user',
        component: () => import('@/views/User'),
        hidden: true
      },
      {
        path: '/examine',
        component: () => import('@/views/Examine'),
        hidden: true
      },
      {
        path: '/person',
        component: () => import('@/views/Person'),
        hidden: true
      },


      {
        path: '/about',
        component: () => import('@/views/About'),
        hidden: true
      },


      {
        path: '/content',
        component: () => import('@/views/Content'),
        hidden: true
      },
      {
        path: '/map',
        component: () => import('@/views/Map'),
        hidden: true
      },
      {
        path: '/book',
        component: () => import('@/views/Book'),
        hidden: true
      },

      {
        path: '/order',
        component: () => import('@/views/Order'),
        hidden: true
      },

      {
        path: '/effect',
        component: () => import('@/views/Effect'),
        hidden: true
      },
      {
        path: '/mouseClick',
        component: () => import('@/views/MouseClick'),
        hidden: true
      },

      {
        path: '/myBook',
        component: () => import('@/views/MyBook'),
        hidden: true
      },




    ]
  },







  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
